package com.huiyi.shopping_markt.service.impl;

import java.util.List;
import com.huiyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huiyi.shopping_markt.mapper.ShoppingMarktMapper;
import com.huiyi.shopping_markt.domain.ShoppingMarkt;
import com.huiyi.shopping_markt.service.IShoppingMarktService;

/**
 * 商品Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-28
 */
@Service
public class ShoppingMarktServiceImpl implements IShoppingMarktService 
{
    @Autowired
    private ShoppingMarktMapper shoppingMarktMapper;

    /**
     * 查询商品
     * 
     * @param id 商品主键
     * @return 商品
     */
    @Override
    public ShoppingMarkt selectShoppingMarktById(Long id)
    {
        return shoppingMarktMapper.selectShoppingMarktById(id);
    }

    /**
     * 查询商品列表
     * 
     * @param shoppingMarkt 商品
     * @return 商品
     */
    @Override
    public List<ShoppingMarkt> selectShoppingMarktList(ShoppingMarkt shoppingMarkt)
    {
        return shoppingMarktMapper.selectShoppingMarktList(shoppingMarkt);
    }

    /**
     * 新增商品
     * 
     * @param shoppingMarkt 商品
     * @return 结果
     */
    @Override
    public int insertShoppingMarkt(ShoppingMarkt shoppingMarkt)
    {
        shoppingMarkt.setCreateTime(DateUtils.getNowDate());
        return shoppingMarktMapper.insertShoppingMarkt(shoppingMarkt);
    }

    /**
     * 修改商品
     * 
     * @param shoppingMarkt 商品
     * @return 结果
     */
    @Override
    public int updateShoppingMarkt(ShoppingMarkt shoppingMarkt)
    {
        shoppingMarkt.setUpdateTime(DateUtils.getNowDate());
        return shoppingMarktMapper.updateShoppingMarkt(shoppingMarkt);
    }

    /**
     * 批量删除商品
     * 
     * @param ids 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteShoppingMarktByIds(Long[] ids)
    {
        return shoppingMarktMapper.deleteShoppingMarktByIds(ids);
    }

    /**
     * 删除商品信息
     * 
     * @param id 商品主键
     * @return 结果
     */
    @Override
    public int deleteShoppingMarktById(Long id)
    {
        return shoppingMarktMapper.deleteShoppingMarktById(id);
    }
}
